//: InheritInner.java 
// Inheriting an inner class 

import static java.lang.System.out;

class WithInner {

    private String name;

    public WithInner(String n) {
        name = n;
        out.println("Construct WithInner class, name=" + name);
    }

    class Inner {
        protected String innerName;
        public Inner(String n) {
            innerName = n;
            out.println("Construct Inner class, WithInner name=" + name +", Inner name="+innerName);
        }
    }
}

public class InheritInner
        extends WithInner.Inner {

    //InheritInner() {} // Won't compile 
    InheritInner(WithInner wi) {
        wi.super("inner");
        out.println("Construct InheritInner");
        //out.println(name);
        out.println(innerName);
    }

    public static void main(String[] args) {
        WithInner wi = new WithInner("withinner");
        InheritInner ii = new InheritInner(wi);
    }
} ///:~
